CC          = @CC@
AR          = @AR@
RANLIB      = @RANLIB@
LIBNAME     = @LIBNAME@
srcdir      = @srcdir@
CC_SHL      = @CC_SHL@
SHLIBNAME   = @SHLIBNAME@

INCLUDES    = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include
CFLAGS      = @CPPFLAGS@ @CFLAGS@ $(INCLUDES)

top_builddir  = @master_topbuild_dir@
LIBTOOL       = @LIBTOOL@
C_COMPILE_SHL = $(CC_SHL) @CFLAGS@ $(INCLUDES)

@VPATH@

AD_LUSTRE_OBJECTS = ad_lustre.o ad_lustre_open.o \
      ad_lustre_rwcontig.o ad_lustre_wrcoll.o ad_lustre_wrstr.o  \
      ad_lustre_hints.o ad_lustre_aggregate.o


default: $(LIBNAME)
	@if [ "@ENABLE_SHLIB@" != "none" ] ; then \
	    $(MAKE) $(SHLIBNAME).la ;\
	fi

.SUFFIXES: $(SUFFIXES) .p .lo

.c.o:
	$(CC) $(CFLAGS) -c $<
.c.lo:
	$(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o
	@mv -f _s$*.o $*.lo

$(LIBNAME): $(AD_LUSTRE_OBJECTS)
	$(AR) $(LIBNAME) $(AD_LUSTRE_OBJECTS)
	$(RANLIB) $(LIBNAME)

AD_LUSTRE_LOOBJECTS=$(AD_LUSTRE_OBJECTS:.o=.lo)
$(SHLIBNAME).la: $(AD_LUSTRE_LOOBJECTS)
	$(AR) $(SHLIBNAME).la $(AD_LUSTRE_LOOBJECTS)

coverage:
	-@for file in  ${AD_LUSTRE_OBJECTS:.o=.c} ; do \
		gcov -b -f $$file ; done

clean:
	@rm -f *.o *.lo
